/* 全局样式重置 - 关键设置确保无滚动 */
:global(*) {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden; /* 禁止所有元素的溢出滚动 */
}

/* 页面容器 - 强制单屏显示且无滚动 */
.page {
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #1c253d 0%, #262239 100%);
    background-attachment: fixed;
    position: relative;
    z-index: 1;
    padding: 1rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.page.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* 背景装饰文字 */
.background-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.text-layer {
    position: absolute;
    color: rgba(255, 255, 255, 0.05);
    font-size: clamp(80px, 20vw, 120px);
    font-weight: 900;
    text-transform: uppercase;
    opacity: 0;
    animation: floatText 60s linear infinite;
    user-select: none;
}

/* 主应用容器 - 三列布局 */
.app-container {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 260px 1fr 180px; /* 左侧导航 - 主内容 - 右侧功能区 */
    grid-gap: 1rem;
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(12px);
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    padding: 1rem;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* 左侧导航区 */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: rgba(15, 23, 42, 0.7);
    border-radius: 16px;
    padding: 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.07);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10;
}

/* Logo 样式 */
.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0;
}

.logo-img {
    border-radius: 12px;
    opacity: 0.95;
    border: 2px solid rgba(0, 198, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 198, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo-img:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 0 25px rgba(0, 198, 255, 0.3);
}

/* 主导航 */
.main-nav {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    text-decoration: none;
    color: #e0f7ff;
    font-family: "Noto Sans SC", sans-serif;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.nav-link.selected {
    background: rgba(0, 198, 255, 0.2);
    color: #00c6ff;
    text-shadow: 0 0 8px rgba(0, 198, 255, 0.8);
    border: 1px solid #00c6ff;
}

.nav-link::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 198, 255, 0.1), transparent);
    transition: 0.6s;
}

.nav-link:hover::before {
    left: 100%;
}

.nav-icon {
    width: 20px;
    height: 20px;
    color: #00c6ff;
    filter: drop-shadow(0 0 5px rgba(0, 198, 255, 0.6));
}

.nav-link:hover {
    color: #00c6ff;
    background: rgba(0, 198, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 198, 255, 0.15);
}

.nav-link:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 198, 255, 0.1);
}

/* 搜索框样式 */
.search-container {
    margin-top: 1px;
    position: relative;
    transition: all 0.3s ease;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 8px 14px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.search-icon {
    width: 18px;
    height: 18px;
    color: #a0c4ff;
}

.search-input {
    background: transparent;
    border: none;
    outline: none;
    color: #e0f7ff;
    font-size: 14px;
    flex: 1;
    min-width: 0;
    padding: 4px 0;
}

.search-input::placeholder {
    color: #a0c4ff;
    opacity: 0.7;
}

.search-container.focused .search-input-wrapper {
    background: rgba(0, 198, 255, 0.08);
    border-color: rgba(0, 198, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 198, 255, 0.15);
}

.search-container.focused .search-icon {
    color: #00c6ff;
    filter: drop-shadow(0 0 5px rgba(0, 198, 255, 0.6));
}

.clear-search {
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
    transition: all 0.2s ease;
}

.clear-search:hover {
    color: #00c6ff;
}

.clear-icon {
    width: 16px;
    height: 16px;
}

/* 搜索结果样式 */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 6px;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    z-index: 100;
    max-height: 280px;
    overflow-y: auto;
    padding: 8px 0;
    border: 1px solid rgba(0, 198, 255, 0.15);
}

.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb {
    background: rgba(0, 198, 255, 0.3);
    border-radius: 3px;
}

.search-result-group {
    padding: 8px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-result-group:last-child {
    border-bottom: none;
}

.search-result-group:hover {
    background: rgba(255, 255, 255, 0.03);
}

.result-graph-title {
    font-size: 13px;
    color: #00c6ff;
    margin-bottom: 4px;
    font-weight: 600;
}

.result-nodes {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.result-node {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(0, 198, 255, 0.1);
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    color: #e2e8f0;
}

.result-node:hover {
    background: rgba(0, 198, 255, 0.15);
    border-color: rgba(0, 198, 255, 0.3);
    color: #00c6ff;
}

.result-node strong {
    color: #00c6ff;
    font-weight: 500;
}

.no-results {
    padding: 14px 14px;
    color: #94a3b8;
    font-size: 13px;
    text-align: center;
}

/* 中间主内容区 - 图谱展示（关键：铺满容器） */
.main-content {
    position: relative;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 图谱容器 - 关键设置确保铺满 */
.graph-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

.graph-container {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

.graph-transition-out {
    opacity: 0;
    transform: scale(0.95);
}

.graph-transition-in {
    opacity: 1;
    transform: scale(1);
}

/* 右侧功能按钮组 - 上下排列样式修改 */
.right-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: rgba(15, 23, 42, 0.7);
    border-radius: 16px;
    padding: 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.07);
    z-index: 10;
}

/* 功能按钮组 - 上下排列 */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center; /* 水平居中 */
}

.icon-btn {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid transparent;
    cursor: pointer;
}

.favorite-btn {
    color: #f87171;
}

.favorite-icon {
    font-size: 22px;
    transition: all 0.3s ease;
}

.favorite-icon.active {
    color: #ef4444;
    animation: pulse 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.5));
}

.dislike-btn {
    color: #94a3b8;
}

.dislike-icon {
    font-size: 22px;
    transition: all 0.3s ease;
}

.dislike-icon.active {
    color: #64748b;
    animation: rotate 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.share-btn {
    color: #60a5fa;
}

.share-icon {
    font-size: 22px;
    transition: all 0.3s ease;
}

.share-btn:hover .share-icon {
    color: #3b82f6;
    transform: rotate(15deg) scale(1.1);
}

/* 下载按钮 - 菜单显示在下方 */
.download-btn {
    color: #22c55e;
    position: relative; /* 关键：作为下拉菜单的定位参考 */
}

.download-icon {
    font-size: 22px;
    transition: all 0.3s ease;
}

.download-btn:hover .download-icon {
    color: #16a34a;
    transform: translateY(-2px);
}

/* 下载下拉菜单 - 显示在按钮下方 */
.download-dropdown {
    position: relative;
    display: inline-block;
}

.download-options {
    position: absolute;
    bottom: 100%; /* 相对于按钮底部定位 */
    left: 50%;
    transform: translateX(-50%); /* 水平居中 */
    margin-bottom: 10px; /* 与按钮保持距离 */
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 140px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 10px); /* 初始位置在下方 */
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.download-dropdown:hover .download-options {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0); /* 移动到正确位置 */
}

.download-option {
    width: 100%;
    padding: 8px 14px;
    text-align: left;
    background: transparent;
    border: none;
    color: #e2e8f0;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin: 2px 0;
    cursor: pointer;
}

.download-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.download-option .option-icon {
    font-size: 16px;
}

/* 下拉菜单箭头 */
.download-options::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: inherit;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateX(-50%) rotate(45deg);
    z-index: -1;
}

/* 上下切换按钮组 */
.nav-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: auto; /* 推到右侧栏底部 */
}

.control-btn {
    padding: 10px 14px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 14px;
    background: linear-gradient(135deg, rgba(74, 108, 247, 0.2) 0%, rgba(54, 88, 224, 0.2) 100%);
    border: 1px solid rgba(74, 108, 247, 0.3);
    color: #e0f7ff;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.control-btn:hover {
    background: linear-gradient(135deg, rgba(74, 108, 247, 0.3) 0%, rgba(54, 88, 224, 0.3) 100%);
    border-color: rgba(74, 108, 247, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.2);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(74, 108, 247, 0.15);
}

.nav-btn .btn-icon {
    font-size: 18px;
}

/* 禁用状态样式 */
.control-btn.disabled,
.icon-btn:disabled {
    background: linear-gradient(135deg, rgba(100, 116, 139, 0.1) 0%, rgba(71, 85, 105, 0.1) 100%);
    border-color: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

/* 移动端菜单 */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1000;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    color: #e0f7ff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.menu-icon {
    font-size: 20px;
}

/* 动画效果 */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(-15deg); }
    100% { transform: rotate(0deg); }
}

@keyframes floatText {
    0% {
        transform: translate(0, 0) rotate(0);
        opacity: 0;
    }
    10% {
        opacity: 0.02;
    }
    90% {
        opacity: 0.02;
    }
    100% {
        transform: translate(100px, 200px) rotate(10deg);
        opacity: 0;
    }
}

/* 响应式布局 */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 220px 1fr 160px;
        grid-gap: 0.8rem;
        padding: 0.8rem;
    }

    .sidebar, .right-sidebar {
        padding: 1rem;
    }

    .icon-btn {
        width: 46px;
        height: 46px;
    }
}

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
        padding: 0.5rem;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 260px;
        transform: translateX(-100%);
        padding: 1.5rem 1rem 1rem;
        border-radius: 0 16px 16px 0;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.3);
    }

    .right-sidebar {
        grid-row: 2;
        flex-direction: row;
        padding: 0.8rem;
        gap: 0.8rem;
    }

    .action-buttons {
        flex-direction: row;
        gap: 0.6rem;
    }

    .nav-buttons {
        flex-direction: row;
        margin-top: 0;
        gap: 0.6rem;
        margin-left: auto;
    }

    .mobile-menu-toggle {
        display: flex;
    }
}

@media (max-width: 480px) {
    .page {
        padding: 0.3rem;
    }

    .icon-btn {
        width: 40px;
        height: 40px;
    }

    .favorite-icon, .dislike-icon, .share-icon, .download-icon {
        font-size: 18px;
    }
}
